package me.ywy.simplelauncher.base;

import me.ywy.ltnetgame.test.apkinfo.R;
import me.ywy.simplelauncher.home.HomePageActivity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.TextView;

public class ShortCut {
	String label;
	Drawable icon;
	Intent intent;
	View view;

	public View getView() {
		return view;
	}

	public void initView() {
		View view = HomePageActivity.getInstance().getLayoutInflater().inflate(R.layout.shortcut_item, null);
		ImageView img = (ImageView) view.findViewById(R.id.shortcut_item_icon);
		img.setImageDrawable(icon);
		TextView text = (TextView) view.findViewById(R.id.shortcut_item_label);
		text.setText(label);
		this.view = view;
		setColor(Config.getFontColor());
		setSize(Config.getIconSize());
	}

	int id;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public Drawable getIcon() {
		return icon;
	}

	public void setIcon(Drawable icon) {
		this.icon = icon;
	}

	public Intent getIntent() {
		return intent;
	}

	public void setIntent(Intent intent) {
		this.intent = intent;
	}

	public void setColor(int color) {
		TextView text = (TextView) view.findViewById(R.id.shortcut_item_label);
		text.setTextColor(color);
	}

	public void setSize(int size) {
		ImageView img = (ImageView) view.findViewById(R.id.shortcut_item_icon);
		LayoutParams para;
		para = img.getLayoutParams();
		para.height = size;
		para.width = size;
		img.setLayoutParams(para);
	}

}
